feat: expose all 10 MCP tools via CLI + document them#42
Merged
PatrickSys merged 8 commits intomasterfrom Feb 21, 2026
Merged
Conversation
…and-ranked-search
- Add handleCliCommand() in src/cli.ts with 8 new subcommands: search, metadata, status, reindex, style-guide, patterns, refs, cycles - Each maps 1:1 to existing tool handlers via dispatchTool() - Create initToolContext() that builds ToolContext from persisted index - Add required-flag validation (--query for search, --symbol for refs) - Support --json flag for scripting/piping - Update src/index.ts routing to send CLI_SUBCOMMANDS to handleCliCommand - Expand README "CLI Access" → "CLI Reference" with all 9 commands - Add "CLI Reference" section to docs/capabilities.md with command table CLI now enables vendor-neutral access for scripting, debugging, and CI. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryExposes all 10 MCP tools as CLI commands for vendor-neutral scripting and debugging. Creates Major changes:
Issues found:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| src/cli.ts | Added 8 new CLI commands mapping to MCP tools with initToolContext() and dispatchTool() integration. Found one logic bug in filter construction for search command. |
| src/index.ts | Updated CLI command routing to use handleCliCommand() instead of handleMemoryCli(), added CLI_SUBCOMMANDS array. Clean refactor with no issues. |
| README.md | Expanded CLI documentation from memory-only to all 10 MCP tools with examples. Well-structured and clear. |
| docs/capabilities.md | Added comprehensive CLI reference table mapping commands to MCP tools. Good technical documentation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start[CLI Entry: npx codebase-context] --> Parse[handleCliCommand argv]
Parse --> Memory{command === 'memory'?}
Memory -->|Yes| MemoryCLI[handleMemoryCli]
Memory -->|No| Init[initToolContext]
Init --> CheckIndex{index exists?}
CheckIndex -->|Yes| Ready[indexState: 'ready']
CheckIndex -->|No| Idle[indexState: 'idle']
Ready --> Route[Route by command]
Idle --> Route
Route --> Search[search → search_codebase]
Route --> Metadata[metadata → get_codebase_metadata]
Route --> Status[status → get_indexing_status]
Route --> Reindex[reindex → refresh_index]
Route --> StyleGuide[style-guide → get_style_guide]
Route --> Patterns[patterns → get_team_patterns]
Route --> Refs[refs → get_symbol_references]
Route --> Cycles[cycles → detect_circular_dependencies]
Search --> Dispatch[dispatchTool]
Metadata --> Dispatch
Status --> Dispatch
StyleGuide --> Dispatch
Patterns --> Dispatch
Refs --> Dispatch
Cycles --> Dispatch
Reindex --> PerformIndex[ctx.performIndexing]
PerformIndex --> Dispatch
Dispatch --> Format{--json flag?}
Format -->|Yes| JSON[console.log raw JSON]
Format -->|No| Pretty[console.log formatted]
JSON --> End[Exit]
Pretty --> End
Last reviewed commit: 9a2d523
- Removed unused import of Memory from src/index.ts. - Simplified error message construction in src/core/symbol-references.ts. - Reorganized risk level calculation in src/tools/search-codebase.ts for clarity and consistency. - Added a TODO comment for reviewing confidence calculation in src/tools/search-codebase.ts.
- Renamed riskLevel variable to _riskLevel for clarity. - Added a TODO comment to review the risk level calculation logic. - Adjusted risk level assignment based on cycle count and impact candidates.
Owner
Author
|
@copilot review |
|
@PatrickSys I've opened a new pull request, #43, to work on those changes. Once the pull request is ready, I'll request review from you. |
…tting - Consolidated console.log statements in src/cli.ts for better readability. - Enhanced error message formatting in src/core/symbol-references.ts and src/tools/search-codebase.ts for consistency. - Streamlined conditional object construction in src/tools/search-codebase.ts for clarity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements CLI commands for all 10 MCP tools, enabling vendor-neutral access for scripting, debugging, and CI workflows.
search,metadata,status,reindex,style-guide,patterns,refs,cyclesdispatchTool()initToolContext()that builds a ToolContext from the persisted on-disk index (no MCP server needed)--jsonflag for JSON output (default: human-readable)Documentation
Test Coverage
--help,status, error cases,memory list🤖 Generated with Claude Code